package mspdt.pocket.wallet;

import java.util.ArrayList;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class CashAdapter extends ArrayAdapter<String> {
	private final Activity context;
	private ArrayList<String> amounts = new ArrayList<String>();
	private ArrayList<String> dates = new ArrayList<String>();
	private ArrayList<String> categories = new ArrayList<String>();
	private ArrayList<String> descriptions = new ArrayList<String>();
	
	
	public CashAdapter(Activity context, ArrayList<String> categories, ArrayList<String> amounts, ArrayList<String> dates, ArrayList<String> descriptions) {
		super(context, R.layout.account_list);
		this.context = context;
		this.categories = categories;
		this.amounts = amounts;
		this.dates = dates;
		this.descriptions = descriptions;

	}
	


	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = context.getLayoutInflater();
		View rowView = inflater.inflate(R.layout.account_list, null, true);
		
		TextView tv_date = (TextView)rowView.findViewWithTag(R.id.account_list_date);
		TextView tv_category = (TextView)rowView.findViewWithTag(R.id.account_list_name);
		TextView tv_amount = (TextView)rowView.findViewWithTag(R.id.account_list_amount);
		TextView tv_description = (TextView)rowView.findViewWithTag(R.id.account_list_desc);
		
		tv_date.setText(dates.get(position));
		tv_category.setText(categories.get(position));
		tv_amount.setText(amounts.get(position));
		tv_description.setText(descriptions.get(position));
		
		return rowView;
	}
}